const inquirer = require("inquirer");

// 询问生成项目的必要信息
function asking(type, number) {
  const questions = [
    {
      type: "input",
      name: "prefix",
      message: "文件前缀",
      validate: (value) => (value ? true : "请输入文件前缀"),
    },
    {
      type: "input",
      name: "suffix",
      message: "文件后缀",
      when: (answers) => type === "file",
    },
    {
      type: "input",
      name: "inputNum",
      message: "文件数量",
      when: (answers) => !number,
    },
  ];

  return inquirer.prompt(questions);
}

module.exports = asking;
